// 封装所有和用户相关的接口函数
import request from "@/utils/http";

//密码登录
export const loginAPI = (data) => {
  return request({
    url: "/gscloud_auth/ua/login",
    method: "POST",
    data: data,
  });
};

//验证码登录注册
export const codeLoginAPI = (data) => {
  return request({
    url: "/gscloud_user/ua/user/register/regorlogin",
    method: "POST",
    params: data,
  });
};

export const registerAPI = (data) => {
  return request({
    url: "/gscloud_user/ua/user/register",
    method: "POST",
    data: data,
  });
};

export const getLikeListAPI = ({ limit = 4 }) => {
  return request({
    url: "/goods/relevant",
    params: {
      limit,
    },
  });
};

//获取验证码
export const getPhoneCodeAPI = (data) => {
  return request({
    url: "/gscloud_user/ua/user/register/sendMassage",
	method: "POST",
    params: {
      mobile:data
    },
  });
};

// 获取用户信息
export const getUserInfoAPI = (data) => {
  return request({
    url: "/gscloud_user/a/user/ma/user_detail_info",
    method: "GET",
    params: data,
  });
};

// 编辑用户信息
export const updateUserInfoAPI = (data) => {
  return request({
    url: "/gscloud_user/a/user/ma/update_user",
    method: "POST",
    data,
  });
};

// 获取用户收货地址列表
export const getAddrListAPI = () => {
  return request({
    url: "/gscloud_user/user_addr/list",
  });
};

// 新增用户地址
export const AddAddrAPI = (data) => {
  return request({
    url: "/gscloud_user/user_addr/save",
    method: "POST",
    data,
  });
};

// 更新用户地址
export const updateAddrAPI = (data) => {
  return request({
    url: "/gscloud_user/user_addr/update",
    method: "POST",
    data,
  });
};

// 删除用户地址
export const delAddrAPI = (data) => {
  return request({
    url: "/gscloud_user/user_addr/delete",
    method: "POST",
    params: data,
  });
};

// 上传文件接口
export const uploadAPI = (data) => {
  return request({
    url: "/gscloud_biz/oss/upload_minio",
    method: "POST",
    data,
  });
};
